﻿ #region Disclaimer/Info
 
 /////////////////////////////////////////////////////////////////////////////////////////////////
 //
 //   File:		ICategoryRepository.cs
 //   Website:		http://dexterblogengine.com/
 //   Authors:		http://dexterblogengine.com/About.ashx
 //   Rev:		1
 //   Created:		19/01/2011
 //   Last edit:		19/01/2011
 //   License:		GNU Library General Public License (LGPL)
 //   File:            ICategoryRepository.cs
 //   For updated news and information please visit http://dexterblogengine.com/
 //   Dexter is hosted to Codeplex at http://dexterblogengine.codeplex.com
 //   For any question contact info@dexterblogengine.com
 //
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
 #endregion

using System;
using System.Collections.Generic;
using Dexter.Domain.Model;

namespace Dexter.Repository {

	/// <summary>
	/// 	Rapresents a repository of <see cref="Category"/>.
	/// </summary>
	public interface ICategoryRepository : IRepository <Category> {
		/// <summary>
		/// 	Retrieve the defalt category.
		/// </summary>
		/// <returns>An instance of Category. </returns>
		Category GetDefaultCategory ( );

		/// <summary>
		/// 	Retrieve the defalt category.
		/// </summary>
		/// <param name = "enableTracking">if set to <c>true</c> the tracking system of the return object will be enable.</param>
		/// <returns>An instance of Category.</returns>
		Category GetDefaultCategory ( bool enableTracking );

		/// <summary>
		/// 	Gets the default category with child and parent.
		/// </summary>
		/// <returns>An instance of Category with all tree loaded</returns>
		Category GetDefaultCategoryWithChilds ( );

		/// <summary>
		/// 	Gets the default category with child and parent.
		/// </summary>
		/// <param name = "enableTracking">if set to <c>true</c> the tracking system of the return object will be enable.</param>
		/// <returns>An instance of Category.</returns>
		Category GetDefaultCategoryWithChilds ( bool enableTracking );

		///<summary>
		///	Retrieve a Category by its name.
		///</summary>
		///<param name = "key">The key.</param>
		///<returns>
		///	Null if there isn't a category wich specified name, otherwise an instance of Category.
		///	The Parent and Childs are not fetched.
		///</returns>
		///<exception cref="ArgumentOutOfRangeException"> If <paramref name="key"/> is lesser than 0.</exception>
		Category GetCategoryByKey ( int key );

		///<summary>
		///	Retrieve a Category by its name.
		///</summary>
		///<param name = "key">The key.</param>
		///<returns>
		///	Null if there isn't a category wich specified name, otherwise an instance of Category.
		///	The Parent and Childs are not fetched.
		///</returns>
		///<exception cref="ArgumentOutOfRangeException"> If <paramref name="key"/> is lesser than 0.</exception>
		Category GetCategoryByKeyWithChilds ( int key );

		///<summary>
		///	Retrieve a Category by its name.
		///</summary>
		///<param name = "key">The key.</param>
		/// <param name = "enableTracking">if set to <c>true</c> the tracking system of the return object will be enable.</param>
		///<returns>
		///	Null if there isn't a category wich specified name, otherwise an instance of Category.
		///	The Parent and Childs are not fetched.
		///</returns>
		///<exception cref="ArgumentOutOfRangeException"> If <paramref name="key"/> is lesser than 0.</exception>
		Category GetCategoryByKeyWithChilds ( int key , bool enableTracking );

		///<summary>
		///	Retrieve a Category by its name.
		///</summary>
		///<param name = "name">The name.</param>
		/// <param name = "enableTracking">if set to <c>true</c> the tracking system of the return object will be enable.</param>
		///<returns>
		///	Null if there isn't a category wich specified name, otherwise an instance of Category.
		///	The Parent and Childs are not fetched.
		///</returns>
		Category GetCategoryByNameWithChilds(string name, bool enableTracking);

		/// <summary>
		/// 	Deletes the specified category and moved the into into another.
		/// </summary>
		/// <param name = "category">The category to delete.</param>
		/// <param name = "newCategory">The new category for the posts of the old category.</param>
		///<exception cref="ArgumentNullException"> If <paramref name="category"/> is <c>null</c>.</exception>
		void DeleteCategory ( Category category , Category newCategory );

		/// <summary>
		/// 	Saves the specified category.
		/// </summary>
		/// <param name="category">The category to save.</param>
		///<exception cref="ArgumentNullException"> If <paramref name="category"/> is <c>null</c>.</exception>
		void Save ( Category category );

		/// <summary>
		/// 	Updates the specified category.
		/// </summary>
		/// <param name = "category">The category to update.</param>
		///<exception cref="ArgumentNullException"> If <paramref name="category"/> is <c>null</c>.</exception>
		void Update ( Category category );

		///<summary>
		///	Retrurn a flat views of all categories from the repository.
		///</summary>
		///<returns>
		///	The return value will never be null, there is always the default category.
		///	The tree il completely loaded.
		///</returns>
		IEnumerable <Category> GetCategoriesStructure ( );

		/// <summary>
		/// Retrurn a strucured views of all categories from the repository.
		/// </summary>
		/// <param name = "enableTracking">if set to <c>true</c> the tracking system of the return object will be enable.</param>
		/// <returns>
		/// The return value will never be null, there is always the default category.
		/// The tree il completely loaded.
		/// </returns>
		IEnumerable <Category> GetCategoriesStructure ( bool enableTracking );

		///<summary>
		///	Retrurn a strucured views of all categories from the repository.
		///</summary>
		///<returns>
		///	The return value will never be null, there is always the default category.
		///	The tree il completely loaded.
		///</returns>
		IEnumerable<Category> GetAllCategories ( );

		/// <summary>
		/// Retrurn a flat views of all categories from the repository.
		/// </summary>
		/// <param name = "enableTracking">if set to <c>true</c> the tracking system of the return object will be enable.</param>
		/// <returns>
		/// The return value will never be null, there is always the default category.
		/// The tree il completely loaded.
		/// </returns>
		IEnumerable<Category> GetAllCategories ( bool enableTracking );

		/// <summary>
		/// This method will update the property <see cref="Category.ContentNumber"/> for each category
		/// </summary>
		void UpdateCategoryStatistics ( );
	}
}
